// <editor-fold defaultstate="collapsed" desc="GNU GPLv3 Header">
/*
 * File:   WaveFormat.java
 *
 * Copyright (C) 2013 Robert Antoni Buj Gelonch <rbuj@uoc.edu>
 * Copyright (C) 2013 David Megias Jimenez <dmegias@uoc.edu>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
// </editor-fold>
package uoc.libwave;

/**
 * Class for storing a generic WAVE file format and, for reading and writing its
 * content in Data I/O Streams.
 *
 * @author Robert Antoni Buj Gelonch <rbuj@uoc.edu>
 * @version 1.0
 * @since 2013-08-27
 */
abstract class WaveFormat extends LittleEndianBinaryFileOps {

    /**
     * Microsoft Pulse Code Modulation (PCM) format.
     */
    static short WAVE_FORMAT_PCM = 0x0001;
    /**
     * IEEE float
     */
    static short WAVE_FORMAT_IEEE_FLOAT = 0x0003;
    /**
     * 8-bit ITU-T G.711 A-law
     */
    static short WAVE_FORMAT_ALAW = 0x0006;
    /**
     * 8-bit ITU-T G.711 U-law
     */
    static short WAVE_FORMAT_MULAW = 0x0007;
    /**
     * IBM mu-law format
     */
    static short IBM_FORMAT_MULAW = 0x0101;
    /**
     * IBM a-law format
     */
    static short IBM_FORMAT_ALAW = 0x0102;
    /**
     * IBM AVC Adaptive Differential Pulse Code Modulation format
     */
    static short IBM_FORMAT_ADPCM = 0x0103;
    /**
     * Determined by SubFormat
     */
    static short WAVE_FORMAT_EXTENSIBLE = (short) 0xFFFE;

    /**
     * WAVE Header
     */
    ChunkHeader headerWaveFile;

    /**
     * 
     * @since 2013-08-27
     */
    public WaveFormat() {
    }

    /**
     * 
     * @since 2013-08-31
     */
    WaveFormat(int MasterChunkSize){
        headerWaveFile = new ChunkHeader(MasterChunkSize);
    }
    /**
     *
     * @param HeaderChunkID
     * @param HeaderChunkSize
     * @param HeaderRiffType
     *
     * @since 2013-08-27
     */
    public WaveFormat(String HeaderChunkID, int HeaderChunkSize,
            String HeaderRiffType) {
        headerWaveFile = new ChunkHeader(HeaderChunkID, HeaderChunkSize,
                HeaderRiffType);
    }

    /**
     * 
     * @return
     *
     * @since 2013-08-27
     */
    abstract int getNumSamples();

    /**
     * 
     * @return
     *
     * @since 2013-08-27
     */
    abstract int getDwSamplesPerSec();

}
